﻿using System.Configuration;


namespace FileMonitor.Service.Configuration
{
    public class ProcessSection : ConfigurationSection
    {
        private static readonly ConfigurationProperty _propDefaultProcess;
        private static ConfigurationPropertyCollection _properties;
        private static readonly ConfigurationProperty _propProcesses;
        static ProcessSection()
        {
            _propProcesses = new ConfigurationProperty("processes", typeof(ProviderSettingsCollection), null, ConfigurationPropertyOptions.None);
            _propDefaultProcess = new ConfigurationProperty("defaultProcess", typeof(string), "default", null, new StringValidator(1), ConfigurationPropertyOptions.None);
            _properties = new ConfigurationPropertyCollection();
            _properties.Add(_propProcesses);
            _properties.Add(_propDefaultProcess);

        }

        [ConfigurationProperty("defaultProcess", DefaultValue = ""), StringValidator(MinLength = 1)]
        public string DefaultProcess
        {
            get
            {
                return (string)base[_propDefaultProcess];
            }
            set
            {
                base[_propDefaultProcess] = value;
            }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get
            {
                return _properties;
            }
        }


        [ConfigurationProperty("processes")]
        public ProviderSettingsCollection Processes
        {
            get
            {
                return (ProviderSettingsCollection)base[_propProcesses];
            }
        }
    }
}
